﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using iShoppingBUS;
using iShoppingDTO;

namespace iShopping.Admin
{
    public partial class CauHinhGiaoDiens : System.Web.UI.Page
    {
        protected void Page_PreInit(object sender, EventArgs e)
        {
            GiaoDienDTO giaoDienDto = GiaoDienBUS.SelectGiaoDienMa("Theme001");
            if (giaoDienDto != null)
            {
                this.Theme = giaoDienDto.TenTheme;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string maTheme = TextBox1.Text.Trim();
            string tenTheme = TextBox2.Text.Trim();
            if(!string.IsNullOrEmpty(maTheme) && !string.IsNullOrEmpty(tenTheme))
            {
                GiaoDienDTO giaoDienDto = new GiaoDienDTO();
                giaoDienDto.MaGiaoDien = maTheme;
                giaoDienDto.TenTheme = tenTheme;
                bool res = GiaoDienBUS.InsertGiaoDien(giaoDienDto);
                if(res)
                {
                    this.Page_Load(sender,e);
                }
            }
        }
    }
}
